package com.pinda.controller;


import cn.dev33.satoken.annotation.SaCheckPermission;
import com.pinda.base.entity.PdArea;
import com.pinda.service.IPdAreaService;
import com.pinda.users.entity.PdAddressBook;
import org.springframework.web.bind.annotation.*;
import com.pinda.base.entity.PdArea;
import com.pinda.service.IPdAreaService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.annotation.Resource;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 黄杰
 * @since 2023-06-13
 */
@RestController
@RequestMapping("/pd-area")
public class PdAreaController {
    @Resource
    private IPdAreaService iPdAreaService;

//    @Resource
//    private IPdAreaService iPdAreaService;

    @RequestMapping("add")
    @SaCheckPermission("user.add")
    public int add() {
        System.out.println("--------------------添加用户");
        return 1;
    }
    //查询行政区
    @PostMapping("/findarea")
    public List<PdArea> findarea(){
        return   iPdAreaService.list();
    }

    @PostMapping("getByCode")
    public PdAddressBook getByCode(@RequestBody PdAddressBook pdAddressBook){
        PdAddressBook byCode = this.iPdAreaService.getByCode(pdAddressBook);
        System.out.println(byCode);
        return byCode;
    }


}
